package com.example.repository;

import com.example.entity.Order;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.Date;

/**
 * datetime : 2020/10/7 8:05
 * author : shenxiang
 */
public interface OrderRepository extends JpaRepository<Order,Long> {

    @Transactional
    @Modifying
    @Query(value = "UPDATE seckill_order SET order_status = ?2,update_time = ?3 WHERE order_no = ?1 AND order_status = 0",nativeQuery = true)
    Integer updateStatusByOrderNo(String orderNo, Integer status, Date updateTime);
}
